using System;

// Taken from the Mvvm helpers of Mark Smith, http://www.julmar.com/blog/mark/2009/04/17/WPFMVVMHelperLibraryWPFMVVMTestability.aspx
// original namespace is JulMar.Windows.Interfaces
namespace Elca.MvvmHelpers
{
    /// <summary>
    /// Button types that may be used to dismiss message prompts
    /// </summary>
    public enum QuestionType {
        /// <summary>
        /// OK + Cancel buttons
        /// </summary>
        OKCancel,
        /// <summary>
        /// Yes + No + Cancel buttons
        /// </summary>
        YesNoCancel,
        /// <summary>
        /// Yes + No buttons
        /// </summary>
        YesNo,
    }

    /// <summary>
    /// Result of a IMessageToUser.AskConfirmation call
    /// </summary>
    public enum AnswerType {
        /// <summary>
        /// OK button clicked to dismiss dialog
        /// </summary>
        OK = 1,
        /// <summary>
        /// Cancel button clicked to dismiss dialog
        /// </summary>
        Cancel = 2,
        /// <summary>
        /// Yes button clicked to dismiss dialog
        /// </summary>
        Yes = 6,
        /// <summary>
        /// No button clicked to dismiss dialog
        /// </summary>
        No = 7
    }

    
    /// <summary>
    /// This interface defines a UI controller which can be used to show messages or ask questions
    /// to the user from a ViewModel.
    /// </summary>
    public interface IMessageToUser {

        /// <summary>
        /// Asks a question to the user
        /// </summary>
        /// <param name="caption">Title of the question</param>
        /// <param name="question">Question text</param>
        /// <param name="qt">Question type</param>
        /// <returns>User answer</returns>
        AnswerType AskQuestion(string caption, string question, QuestionType qt);

        /// <summary>
        /// Shows an information message to the user
        /// </summary>
        /// <param name="caption">Message title</param>
        /// <param name="text">Message text</param>
        void ShowInformation(string caption, string text);

        /// <summary>
        /// Shows a warning message to the user
        /// </summary>
        /// <param name="caption">Message title</param>
        /// <param name="text">Message text</param>
        void ShowWarning(string caption, string text);

        /// <summary>
        /// Shows an error message to the user
        /// </summary>
        /// <param name="caption">Message title</param>
        /// <param name="text">Message text</param>
        void ShowError(string caption, string text);

        /// <summary>
        /// Asks the user for some information
        /// </summary>
        /// <param name="caption">Message title</param>
        /// <param name="text">Message text</param>
        /// <param name="initialValue">default reply</param>
        /// <returns>The texte entered by the user or null if canceled</returns>
        string Prompt(string caption, string text, string initialValue = null);
    }
}